import javaService from '../javaHttp'

function handel(data) {
  var params = new URLSearchParams()
  for (const key in data) {
    params.append(key, data[key])
  }
  return params
}

// 分页
export function personnel_getByCondition(data) {
  return javaService({
    url: '/user/getByCondition',
    method: 'GET',
    isLoading: true,
    params: data
  })
}
// 禁用开关
export function visitor_disable(data) {
  return javaService({
    url: '/user/admin/isForbidden',
    method: 'POST',
    isLoading: true,
    data: handel(data)
  })
}
// 删除
export function personnel_delByIds(data) {
  return javaService({
    url: '/user/delByIds/' + [data],
    method: 'DELETE',
    isLoading: true
  })
}
// 添加
export function personnel_add(data) {
  return javaService({
    url: '/user/admin/add',
    method: 'POST',
    isLoading: true,
    data: handel(data)
  })
}
// 角色分配
export function personnel_getAllList(data) {
  return javaService({
    url: '/role/getAllList',
    method: 'GET',
    isLoading: true,
    params: data
  })
}
// 弹出 树形图
export function personnel_departmentTree() {
  return javaService({
    url: '/department/departmentTree',
    method: 'GET',
    isLoading: true
  })
}
// 重置密码
export function personnel_resetPass(data) {
  return javaService({
    url: '/user/resetPass',
    method: 'POST',
    isLoading: true,
    data: handel(data)
  })
}
// 编辑
export function personnel_customeEdit(data) {
  return javaService({
    url: '/user/admin/customeEdit',
    method: 'POST',
    isLoading: true,
    data: handel(data)
  })
}
